home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 5
/
Aminet 5 - March 1995.iso
/
Aminet
/
util
/
wb
/
Amiga_Eyes1_1a.lha
/
EyesSource1.1a.lha
/
EyesCommodity.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-12-02
|
4KB
|
153 lines
/*****************************************************************************/
/* AmigaEyes V1.1a (02/12/1994) */
/* */
/* Author: Stéphane Poirier */
/* Copyright © 1994 Stéphane Poirier. All right reserved */
/* */
/*****************************************************************************/
#include <exec/types.h>
#include <ctype.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <stdlib.h>
#include <stdio.h>
#include <exec/memory.h>
#include <exec/libraries.h>
#include <libraries/commodities.h>
#include <dos/dos.h>
#include <clib/alib_protos.h>
#include <clib/commodities_protos.h>
#include "eyes.h"
#define HOTKEY 1
struct MsgPort *EyesBrokerMsgPort = NULL;
CxObj *EyesBroker = NULL;
CxObj *Filtre, *Sender, *Trans;
CxMsg *MsgBroker;
struct Window *win = NULL;
struct NewBroker NewBroker =
{
NB_VERSION,
"AmigaEyes",
"AmigaEyes 1.1 © 1994 Stéphane Poirier",
"Big Brother is watching you !",
NBU_UNIQUE|NBU_NOTIFY,
COF_SHOW_HIDE,
0,0,0
};
ULONG sigflags;
BOOL Dodo;
BOOL Actif = TRUE;
extern struct Screen *ActiveScreen;
void StartCommodity(void)
{
if ((EyesBrokerMsgPort = CreateMsgPort()) == NULL) SortiePropre();
NewBroker.nb_Port = EyesBrokerMsgPort;
sigflags = 1L << EyesBrokerMsgPort->mp_SigBit;
NewBroker.nb_Pri = Parametres.priorite;
if ((EyesBroker = CxBroker(&NewBroker, NULL)) == NULL) SortiePropre();
if ((Filtre = CxFilter(hotkey)) == NULL) SortiePropre();
AttachCxObj(EyesBroker, Filtre);
if ((Sender = CxSender(EyesBrokerMsgPort, HOTKEY)) == NULL) SortiePropre();
AttachCxObj(Filtre, Sender);
if ((Trans = CxTranslate(NULL)) == NULL) SortiePropre();
AttachCxObj(Filtre, Trans);
if (CxObjError(Filtre))
{
printf("erreur cx\n");
SortiePropre();
}
ActivateCxObj(EyesBroker, TRUE);
}
/*****************************************************************************/
int ProcessMsg(void)
{
ULONG msgid, msgtype;
BOOL running = TRUE;
while(MsgBroker = (CxMsg *)GetMsg(EyesBrokerMsgPort))
{
msgid = CxMsgID(MsgBroker);
msgtype = CxMsgType(MsgBroker);
ReplyMsg((struct Message *)MsgBroker);
switch(msgtype)
{
case CXM_IEVENT:
switch(msgid)
{
case HOTKEY:
if (Dodo)
{
running = ProcessActive();
Dodo = FALSE;
}
else
ActiveScreen = NULL;
running = ProcessJump(FALSE);
break;
default:
break;
}
case CXM_COMMAND:
switch(msgid)
{
case CXCMD_DISABLE:
running = FALSE;
Restart = TRUE;
Dodo = TRUE;
ActivateCxObj(EyesBroker, FALSE);
Actif = FALSE;
break;
case CXCMD_ENABLE:
Dodo = FALSE;
ActivateCxObj(EyesBroker, TRUE);
Actif = TRUE;
break;
case CXCMD_KILL:
running = FALSE;
Restart = FALSE;
Dodo = FALSE;
break;
case CXCMD_UNIQUE:
break;
case CXCMD_DISAPPEAR:
if (Actif)
{
running = FALSE;
Restart = TRUE;
Dodo = TRUE;
}
break;
case CXCMD_APPEAR:
if (Actif)
{
Dodo = FALSE;
}
break;
}
}
}
return (running);
}